package Controller
{
	import Model.Project;
	import Model.Quality;
	
	import View.quality.Airtightness;
	import View.quality.ThermalBridges;
	
	import mx.core.FlexGlobals;

	public class QualityController
	{	
		public function QualityController()
		{
		}
		
		public function updateAirtightnessRare(airtightnessRate:Number):void
		{
			FlexGlobals.topLevelApplication.project.quality.airtightnessRate = airtightnessRate;
		}
		
		public function updateAiritghtnessRateUISection():void
		{
			(FlexGlobals.topLevelApplication.screenCollection[5] as Airtightness).updateAirtightnessRateUISection(FlexGlobals.topLevelApplication.project.quality.airtightnessRate);
		}
		
		public function updateThermalBridgeFree(thermalBridgeFree:Boolean):void
		{
			FlexGlobals.topLevelApplication.project.quality.thermalBridgeFree = thermalBridgeFree;	
		}
		
		public function updateThermalBridgeUISection():void
		{
			(FlexGlobals.topLevelApplication.screenCollection[6] as ThermalBridges).updateThermalBridgesUISection(FlexGlobals.topLevelApplication.project.quality.thermalBridgeFree);
		}
		
		public function getAirtightnessRate():Number
		{
			return FlexGlobals.topLevelApplication.project.quality.airtightnessRate;
		}
		
		public function getThermalBridgeFree():Boolean
		{
			return FlexGlobals.topLevelApplication.project.quality.thermalBridgeFree;
		}
		
		public function updateQualityUIData():void
		{
			this.updateAiritghtnessRateUISection();
			this.updateThermalBridgeUISection();
		}
		
		public function updateQualityStatus():void
		{
			FlexGlobals.topLevelApplication.overviewPalette.qualityStatus();
		}
	}
}